Command Block
The Command Block is a block made with the intent to supportAdventure mode and allows mapmakers to expand the interaction with the player through server commands. The block can run specified server commands when activated by a redstone current. Considering its great power and possibilities, it can't be normally crafted. Currently, it is not available in the creative mode inventory either. Only players with sufficient privileges to use the 'give' command: /give 137 can obtain the block. Furthermore, only players which are in Creative mode and are also an operator on the server are able to edit and successfully save the command of the block. To be able to use this block inmultiplayer, you have to set the value of enable-command-block totrue in the server.properties file. If this line doesn't exist, you'll have to add it. When you are in survival, you can break the command block with a single click, but it doesn't drop anything. When you break a command block with a pickaxe, it will drop. They can't be pushed by pistons, as they have tile entities. The maximum command length is limited to 254 characters. http://www.minecraftwiki.net/index.php?title=Command_Block&action=edit&section=1 editUsage The Command Block will execute server commands like giving items orexperience to a player.[1] To change the command executed by the block, simply right-click it, and a GUI will open. In place of player names, it is possible to use multiple different variables: When using commands, treat them as if entered from the console - you always need to specify the target, so it is not possible to use commands such as "kill" which do not take a player argument. For example, to change the mode to Survival for the nearest player type: /gamemode survival @p. Note that you will have to be in Creative mode to change the command associated with the block. The command block sends commands through the console in singleplayer and multiplayer, though commands can still be prefixed with a "/". If you want to give the nearest player stone, you can enter /give @p 1 or give @p 1. http://www.minecraftwiki.net/index.php?title=Command_Block&action=edit&section=2 editGame Rules Game Rules allow players and command blocks to adjust several base settings. Usage: /gamerule http://www.minecraftwiki.net/index.php?title=Command_Block&action=edit&section=3 editDisabled commands The following commands have been disabled for use with the Command Block. *However, the /me command still works and allows broadcasting of server-wide messages. The command block itself is then represented by "@" symbol (in 13w04a or later the command block will use block's name. Additionally, it's worth noting that the "/me" command normally needs a player context to work, but it works flawlessly with the command block (as well as the server console itself) regardless. http://www.minecraftwiki.net/index.php?title=Command_Block&action=edit&section=4 editArguments After using a target (@a, @p or @r) you can optionally use arguments. This is how you use the arguments: @=,= Example: @px=1,y=30,z=26,r=10,rm=2,m=1,c=3,l=25,lm=3 Alternatively, the coordinates and maximum (but not minimum!) radius can be provided more concisely as long as they're the first (up to four) arguments without keys, for instance: @p1,30,26,10,rm=2,m=1,c=3,l=25,lm=3,score_Kills_min=1,score_Deaths=2,team=Red is identical to the previous example. Because the argument 'c' uses players from the end of a list first when negative, @pc=-1 may be used to select the farthest player instead of the nearest one. http://www.minecraftwiki.net/index.php?title=Command_Block&action=edit&section=5 editHistory http://www.minecraftwiki.net/index.php?title=Command_Block&action=edit&section=6 editExamples *It is possible to make teleporters using the command block. (e.g. code: /tp @pr=3 x y z) *If you use the teleport command with the command block, you can use relative coordinates in the destination coordinates by placing an '~' in front of a Coordinate (e.g. code: /tp @p ~0 ~8 ~0 This would teleport the player 8 blocks into the air). *Commands using coordinates (eg. "/tp" or "/spawnpoint") add 0.5 to integers, like usual. To clarify, the number -33 would be interpreted as -32.5, and the number 187 would be interpreted as 187.5. *The player can make a kind of world guard using the command block. (e.g. code: /gamemode @ar=) *The commandBlockOutput gamerule does not affect the command block using the /say and /me , and /tell commands. *The commands /say Hello, @p and /tell @p Hello, @p will cause the command block to say user name of the nearest player in the message, however /me Hello, @p just causes it to say "Hello, @p".